package com.pzhuweb.sgblog.controller;

import com.pzhuweb.sgblog.annotation.SystemLog;
import com.pzhuweb.sgblog.domain.entity.User;
import com.pzhuweb.sgblog.service.UserService;
import com.pzhuweb.sgblog.domain.utils.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 鄧浩奇
 * @classname UserController
 * @description
 * @since 2023/7/8 16:14
 **/

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/userInfo")
    @SystemLog(businessName = "获取用户信息")
    public ResponseResult<?> getUserInfo() {
        return userService.getUserInfo();
    }

    @PutMapping("userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult<?> saveInfo(@RequestBody User user) {
        return userService.saveInfo(user);
    }

    @PostMapping("/register")
    @SystemLog(businessName = "用户注册")
    public ResponseResult<?> register(@RequestBody User user) {
        return userService.register(user);
    }

}
